﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace STSdb.MTL
{
    /// <summary>
    /// Helper class for managing Distributed Transactions. 
    /// User shouldn't use it
    /// </summary>
    public class TransactionDistributedSupport
    {
        TransactionUnit _transactionUnit = null;
        Transaction _transaction = null;

        public TransactionDistributedSupport(TransactionUnit transactionUnit,Transaction transaction)
        {
            this._transactionUnit = transactionUnit;
            this._transaction = transaction;
        }

        public void DistributedCommitStart(long transactionId)
        {
            this._transactionUnit.TransactionsCoordinator.DistributedCommitStart(_transactionUnit, transactionId);
        }

        public void DistributedRollback(long transactionId)
        {
            this._transactionUnit.TransactionsCoordinator.DistributedRollback(_transactionUnit, transactionId);
        }

        public void DistributedCommitEnd()
        {
            this._transactionUnit.TransactionsCoordinator.DistributedCommitEnd(_transactionUnit);
        }
    }
}
